package fluxx.draft;

import java.util.LinkedList;


public class CardSet extends AbstractCardSet {
	public void add(Card card) {
		cards.add(card);
	}
	
	/*public void remove(Card card) throws OperationNotSupportedException {
		if (!cards.remove(card)) {
			throw new OperationNotSupportedException("Card set empty.");
		}
	}*/
	
	public boolean remove(Card card) {
		// TODO What return type/behaviour do we really want?
		return cards.remove(card);
	}
	
	public void shuffle() {
		LinkedList<Card> shuffledCards = new LinkedList<Card>();
		do {
			int i = (int) (Math.random() * cards.size());
			shuffledCards.add(cards.remove(i));
		} while (cards.size() > 0);
		cards = shuffledCards;
	}
}
